package pub.gll.onepeas.module.car.activity

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Route
import dagger.hilt.android.AndroidEntryPoint
import pub.gll.onepeas.libbase.arouter.ARouterPath
import pub.gll.onepeas.libbase.track.annotation.ViewExposure
import pub.gll.onepeas.libbase.track.api.IViewExposure
import pub.gll.onepeas.libbase.track.manager.KKVEManager
import pub.gll.onepeas.module.car.databinding.ActivityCustomBinding

@AndroidEntryPoint
@Route(path = ARouterPath.ACT_CUSTOM_VIEW)
@ViewExposure
class CustomViewAct :AppCompatActivity(){
    private val mViewBinding : ActivityCustomBinding by lazy {
        ActivityCustomBinding.inflate(layoutInflater)
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        KKVEManager.getInstance().init(application, true, true)
        setContentView(mViewBinding.root)

        mViewBinding.apply {
            var params = HashMap<String, Any>()
            KKVEManager.getInstance().veBindData(mCustomView, params, 0.7f, params, object :
                IViewExposure{
                override fun onViewVisible(
                    view: View?,
                    count: Int,
                    params: java.util.HashMap<String, Any>?
                ) {
                    Log.e("LLLLLLLL","onViewVisible")
                }

                override fun onViewInVisible(
                    view: View?,
                    count: Int,
                    duration: Long,
                    params: java.util.HashMap<String, Any>?
                ) {
                    Log.e("LLLLLLLL","onViewInVisible")
                }

            })
            mCustomView.smoothScrollTo(-200,-300)
        }
    }

    override fun setContentView(view: View?) {
        super.setContentView(view)
        findViewById<View>(android.R.id.content)
    }

}